using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using EPiServer.Shell.Gadgets;

using AnalyticsGadget.Models;

namespace AnalyticsGadget.Controllers
{
    [Gadget(Name = "Statistics - Demographics", Title = "Demographics", IconUrl = "Content/analytics.png")]
    public class StatisticsDemographicsController : BaseStatisticsController
    {
        protected override Report GetReport(string profileID, Timespan timespan)
        {
            ReportQuery query = new ReportQuery(profileID, MetricType.Visits);
            query.AddDimension(DimensionType.Country);
            query.AddSortBy(MetricType.Visits, SortDirection.Descending);
            query.AddSortBy(DimensionType.Country, SortDirection.Descending);
            query.SetTimespan(timespan);

            return StatisticsHelper.GetReport(query);
        }   
    }
}
